package org.github.manx98.jlibhac.fs;

import java.io.IOException;

/**
 * @author Manx98
 * @version 1.0
 * @since 2022/10/3 0:47
 */
public class StreamStorage extends IStorage {
    private final IStorage baseStorage;
    public StreamStorage(IStorage storage) {
        super(0);
        this.baseStorage = storage;
    }

    @Override
    public void read(long offset, byte[] destination, int destOffset, int len) throws IOException {
        this.position = offset;
        this.baseStorage.read(offset, destination, destOffset, len);
        this.position += len;
    }

    @Override
    public long getSize() {
        return this.baseStorage.getSize();
    }
}
